@echo off
echo Activating virtual environment...
call D:\Program_proje\AiUseHelper\.venv\Scripts\activate.bat


:: 清理之前的 build 和 dist 目录
echo Cleaning up old build and dist directories...
if exist "build" (
    rd /s /q "build"
    rd /s /q "dist"
    if errorlevel 1 (
        echo Failed to delete build folder! Check for permission or locked files.
        pause
        exit /b 1
    )
)

echo Starting packaging...
pyinstaller ^
    --onedir ^
    --name "helperUseAI1.1B" ^
    --distpath "dist" ^
    --workpath "build" ^

    --specpath "." ^
    --clean ^
    --noconfirm ^
    --noconsole ^
    "D:\Program_proje\AiUseHelper\source-code\main.py"

if %errorlevel% equ 0 (
    echo  Packaging successful!
) else (
    echo  Packaging failed!
)

pause
@REM